import logging
import redis


class RedisConfig:
    def __init__(self, server, port, db, auth):
        self.server = server
        self.port = port
        self.db = db
        self.auth = auth


class Redis:
    def __init__(self, redis_config):
        self.logger = logging.getLogger("redis")
        self.r = redis.StrictRedis(host=redis_config.server, port=redis_config.port, db=redis_config.db)

    def set(self, key, name):
        self.r.set(key, name)

    def get(self, key):
        value = self.r.get(key)
        self.logger.info('get value: ' + value.decode("utf-8"))
        return value
